package com.action;

import com.bean.ResponseBean;
import com.service.OutputProgrameService;
import com.service.ProgrameTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/api")
public class ProgrameTypeAction {

    @Autowired
    private ProgrameTypeService programeTypeService;

    /**
     * 查询所有类别
     * @return
     */
    @RequestMapping("/type/findAll")
    public ResponseBean  findAll()
    {
        List list = programeTypeService.getAll();
        return new ResponseBean(0,"查询成功",list);
    }

    /**
     * 状态修改
     * @param id
     * @param s
     * @return
     */
    @RequestMapping("/type/status/{id}")
    public ResponseBean  status(@PathVariable int id, int s)
    {

        return new ResponseBean(200,"修改成功",null);
    }

    //编辑框修改
    @RequestMapping("/type/edit")
    public ResponseBean  edit(int id,String name)
    {
        programeTypeService.updateNameById(id,name);
        return new ResponseBean(200,"修改成功",null);
    }

    //改变顺序
    @RequestMapping("/type/changeSort")
    public ResponseBean  changeSort(int id,int type)
    {
        programeTypeService.changeSort(id,type);
        return new ResponseBean(200,"修改成功",null);
    }

    
}
